package net.blogways.ordermgr.util;

import java.io.File;
import java.io.IOException;

/**
 * @author chenxin
 * created on  2017/10/19
 */
public class MakeFile {

  /**
   * 创建文件.
   *
   * @param filePath
   * @param fileName
   */
  public void makeFilePath(String filePath, String fileName) {
    File file = null;
    makeRootDirectory(filePath);
    try {
      file = new File(filePath + fileName);
      if (!file.exists()) {
        file.createNewFile();
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

  /**
   * 创建文件目录.
   *
   * @param filePath
   */
  public void makeRootDirectory(String filePath) {
    File file = null;
    try {
      file = new File(filePath);
      if (!file.exists()) {
        file.mkdirs();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
